
#ifndef _GOLBALENUMMANAGER_H_
#define _GOLBALENUMMANAGER_H_
#include "SimpleRefection.h"
class EnumBase;
class GlobalEnumManager
{
public:
	static  GlobalEnumManager& Instance()
	{
		static GlobalEnumManager _instance;
		return _instance;
	}
	template<typename TEnum,uint32 iCount>
	void RegisterEnum()
	{
		if(LookupEnum<TEnum>()) return;
		m_mEnums[typeid(TEnum).name()]=&EnumTpl<TEnum,iCount>::Instance();
	}
	template<typename TEnum>
	const EnumBase *LookupEnum() const
	{
		std::map<std::string,const EnumBase*>::const_iterator it= m_mEnums.find(typeid(TEnum).name());
		if(it==m_mEnums.end()) return NULL;
		return it->second;
	}
	void EnumerateEnums(std::vector<const EnumBase*>& vEnums);
private:
	GlobalEnumManager();
	std::map<std::string,const EnumBase*> m_mEnums;

};
#endif